using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ItemDimMap : EntityTypeConfiguration<so_ItemDim>
    {
        public so_ItemDimMap()
        {
            // Primary Key
            this.HasKey(t => new { t.item, t.Type, t.Category, t.Type_Id, t.Category_Id });

            // Properties
            this.Property(t => t.item)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Type)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Type_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Category_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Default_Vendor)
                .HasMaxLength(35);

            this.Property(t => t.Custom_2)
                .HasMaxLength(30);

            this.Property(t => t.Custom_3)
                .HasMaxLength(30);

            this.Property(t => t.Custom_4)
                .HasMaxLength(30);

            this.Property(t => t.Custom_5)
                .HasMaxLength(30);

            this.Property(t => t.Season)
                .HasMaxLength(50);

            this.Property(t => t.Usage)
                .HasMaxLength(30);

            this.Property(t => t.Mode_Of_shipment)
                .HasMaxLength(30);

            this.Property(t => t.Item_ABC_Classif)
                .HasMaxLength(2);

            this.Property(t => t.Item_XYZ_Classif)
                .HasMaxLength(2);

            // Table & Column Mappings
            this.ToTable("so_ItemDim");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Type_Id).HasColumnName("Type_Id");
            this.Property(t => t.Category_Id).HasColumnName("Category_Id");
            this.Property(t => t.Default_Vendor).HasColumnName("Default_Vendor");
            this.Property(t => t.Custom_1).HasColumnName("Custom_1");
            this.Property(t => t.Custom_2).HasColumnName("Custom_2");
            this.Property(t => t.Custom_3).HasColumnName("Custom_3");
            this.Property(t => t.Custom_4).HasColumnName("Custom_4");
            this.Property(t => t.Custom_5).HasColumnName("Custom_5");
            this.Property(t => t.Season).HasColumnName("Season");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.Business_unit).HasColumnName("Business_unit");
            this.Property(t => t.Cluster).HasColumnName("Cluster");
            this.Property(t => t.Product_Line).HasColumnName("Product_Line");
            this.Property(t => t.ItemKind).HasColumnName("ItemKind");
            this.Property(t => t.Program).HasColumnName("Program");
            this.Property(t => t.Group_Number).HasColumnName("Group_Number");
            this.Property(t => t.Group__Id).HasColumnName("Group_ Id");
            this.Property(t => t.Subgroup).HasColumnName("Subgroup");
            this.Property(t => t.Family).HasColumnName("Family");
            this.Property(t => t.Usage).HasColumnName("Usage");
            this.Property(t => t.Class).HasColumnName("Class");
            this.Property(t => t.Mode_Of_shipment).HasColumnName("Mode_Of_shipment");
            this.Property(t => t.Item_ABC_Classif).HasColumnName("Item_ABC_Classif");
            this.Property(t => t.Item_XYZ_Classif).HasColumnName("Item_XYZ_Classif");
            this.Property(t => t.Expiry_Date_Enabled).HasColumnName("Expiry_Date_Enabled");
        }
    }
}
